import { MinimalButton, Position, Tooltip } from "../../core";

import { RenderSwitchScrollModeProps } from "./SwitchScrollMode";
import SwitchScrollModeDecorator from "./SwitchScrollModeDecorator";
import { FC } from "react";

const TOOLTIP_OFFSET = { left: 0, top: 8 };

const SwitchScrollModeButton: FC<RenderSwitchScrollModeProps> = ({
  isSelected,
  mode,
  onClick,
}) => (
  <SwitchScrollModeDecorator mode={mode} onClick={onClick}>
    {(props) => (
      <Tooltip
        position={Position.BottomCenter}
        target={
          <MinimalButton isSelected={isSelected} onClick={props.onClick}>
            {props.icon}
          </MinimalButton>
        }
        content={() => props.label}
        offset={TOOLTIP_OFFSET}
      />
    )}
  </SwitchScrollModeDecorator>
);

export default SwitchScrollModeButton;
